﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Ccit.Utils;
using Ccit.ClassLibrary;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Ccit.SysPlat.Organ
{
    public partial class sys_userpwd_edit : Ccit.Utils.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                _hidUserId.Value = (null != Request.QueryString["userid"]) ? Request.QueryString["userid"].ToString() : "";
                MsLoginUser loginUser = (MsLoginUser)Session["LogUserInfo"];
                _hidUserType.Value = loginUser.userType.ToString("D");
                loginUser = null;
            }
        }

        [global::System.Web.Services.WebMethod]
        public static string ModifyPwd(string userType,string userId,string oriPwd, string newPwd)
        {
            UserBLL userBLL = new UserBLL();
            eUserType enUserType = (eUserType)Enum.Parse(typeof(eUserType),userType);
            List<string> lstResult = userBLL.ModifyPwd(userId, enUserType, oriPwd,newPwd);
            var newObj = new
            {
                OPERTYPE = "PWDMODIFY",
                RSTSIGN = lstResult[0],
                RSTMSG = lstResult[1]
            };
            string serExpr = JavaScriptConvert.SerializeObject(newObj);

            newObj = null;
            lstResult = null;
            userBLL.Release();
            userBLL = null;
            return serExpr;    
        }
    }
}
